//
//  WePersonalPublishCell.m
//  WeGalaxy
//
//  Created by Zheng on 2017/7/6.
//  Copyright © 2017年 Zheng. All rights reserved.
//

#import "WePersonalPublishCell.h"

@implementation WePersonalPublishCell

#pragma mark - 初始化
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        [self viewsInContentView];
    }
    return self;
}

#pragma mark - 子视图
- (void)viewsInContentView {
    [self.contentView addSubview:self.iconImgv];
    [self.contentView addSubview:self.nameLbl];
    [self.contentView addSubview:self.priceLbl];
    [self.contentView addSubview:self.advertImgv];
    [self.contentView addSubview:self.contentLbl];
    [self.contentView addSubview:self.lineView];
    [self.contentView addSubview:self.fromLbl];
    
    [_iconImgv mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(25);
        make.top.mas_equalTo(15);
        make.width.height.mas_equalTo(50);
    }];
    
    [_nameLbl mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(_iconImgv.mas_right).offset(12);
        make.centerY.equalTo(_iconImgv);
    }];
    
    [_priceLbl mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_equalTo(-25);
        make.centerY.equalTo(_iconImgv);
    }];
    
    [_advertImgv mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(25);
        make.right.mas_equalTo(-25);
        make.top.equalTo(_iconImgv.mas_bottom).offset(10);
        make.height.mas_equalTo(165);
    }];
    
    [_contentLbl mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(25);
        make.right.mas_equalTo(-25);
        make.top.equalTo(_advertImgv.mas_bottom).offset(10);
    }];
    
    [_fromLbl mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.mas_equalTo(-5);
        make.left.mas_equalTo(28);
    }];
    
    [_lineView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(30);
        make.right.mas_equalTo(-22);
        make.height.mas_equalTo(0.5);
        make.bottom.equalTo(_fromLbl.mas_top).offset(-10);
    }];
}

- (UILabel *)nameLbl {
    if (!_nameLbl) {
        _nameLbl = [UILabel new];
        _nameLbl.text = @"罗力";
        _nameLbl.font = kCX_FONT(15);
    }
    return _nameLbl;
}

- (UIImageView *)iconImgv {
    if (!_iconImgv) {
        _iconImgv = [[UIImageView alloc] init];
        kCX_RADIUS(_iconImgv, 25, 0);
        _iconImgv.layer.backgroundColor = [[UIColor orangeColor] CGColor];
    }
    return _iconImgv;
}

- (UIView *)lineView {
    if (!_lineView) {
        _lineView = [UIView new];
        _lineView.backgroundColor = kRGB_COLOR(200, 199, 204, 1);
    }
    return _lineView;
}

- (UILabel *)priceLbl {
    if (!_priceLbl) {
        _priceLbl = [UILabel new];
        _priceLbl.font = kCX_FONT(15);
        _priceLbl.textColor = kRGB_COLOR(244, 66, 54, 1);
        _priceLbl.text = @"¥ 300";
    }
    return _priceLbl;
}

- (UIImageView *)advertImgv {
    if (!_advertImgv) {
        _advertImgv = [UIImageView new];
        _advertImgv.backgroundColor = [UIColor orangeColor];
    }
    return _advertImgv;
}

- (UILabel *)contentLbl {
    if (!_contentLbl) {
        _contentLbl = [UILabel new];
        _contentLbl.font = kCX_FONT(15);
        _contentLbl.text = @"中关村广告位";
    }
    return _contentLbl;
}

- (UILabel *)fromLbl {
    if (!_fromLbl) {
        _fromLbl = [UILabel new];
        _fromLbl.font = kCX_FONT(11);
        _fromLbl.text = @"来自北京";
        _fromLbl.textColor = kRGB_COLOR(120, 155, 183, 1);
    }
    return _fromLbl;
}


@end
